import 'package:flutter/material.dart';
import 'package:fluttertoast/fluttertoast.dart';

/* *
 * toast
 */

class ToastX {

  /// 顶部Toast
  static Future<bool> top(String text) {
    return Fluttertoast.showToast(
      msg: text,
      toastLength: Toast.LENGTH_SHORT,
      gravity: ToastGravity.TOP,
      timeInSecForIosWeb: 1,
      backgroundColor: Color.fromARGB(123, 0, 0, 0),
      textColor: Colors.white,
      fontSize: 13.0);
  }

  /// 中间Toast
  static Future<bool> center(String text) {
    Fluttertoast.cancel();
    return Fluttertoast.showToast(
        msg: text,
        toastLength: Toast.LENGTH_SHORT,
        gravity: ToastGravity.CENTER,
        timeInSecForIosWeb: 1,
        backgroundColor: Color.fromARGB(123, 0, 0, 0),
        textColor: Colors.white,
        fontSize: 13.0);
  }

  /// 底部Toast
  static Future<bool> bottom(String text) {
    Fluttertoast.cancel();
    return Fluttertoast.showToast(
        msg: text,
        toastLength: Toast.LENGTH_SHORT,
        gravity: ToastGravity.BOTTOM,
        timeInSecForIosWeb: 1,
        backgroundColor: Color.fromARGB(123, 0, 0, 0),
        textColor: Colors.white,
        fontSize: 13.0);
  }
}